class Solution:
    def splitIntoFibonacci(self, S: str):
        def calc(str1,str2):
            return str(int(str1)+int(str2))
        result=[]
        first=1
        while first<len(S)-2:
            result.append(S[:first])
            second=first+1
            if result[0][0]=='0' and first>1:
                return []
            while second<=len(S)-first:
                prev=result[0]
                result.append(S[first:second])
                offset=second
                now=S[first:second]
                if now[0]=='0' and len(now)>1:
                    #first+=1
                    break
                down=len(S)-max([first,second-first])
                while offset<=down:
                    res=calc(prev,now)
                    if offset+len(res)<=len(S) and S[offset:offset+len(res)]==res:
                        prev=now
                        now=res
                        result.append(res)
                        offset=offset+len(res)
                    else:
                        break
                if offset==len(S):
                    result=[int(i) for i in result]
                    for i in result:
                        if i>2147483647:
                            return []
                    return result
                else:
                    result=[result[0]]
                second+=1
            result.pop()
            first+=1
        return []


s=Solution()
print(s.splitIntoFibonacci("539834657215398346785398346991079669377161950407626991734534318677529701785098211336528511"))


'''
32位整型最大值位2的31次方-1
Python整型值无最大值上限，最小8个字节，每次增加4个字节的倍数

51%
62%
'''